<?php
declare (strict_types=1);

namespace app\api\model\yuql;

use think\Model;

/**
 * @mixin \think\Model
 */
class Order extends Model
{
    protected $table = '2008a_store_order';

    /**
     * yuql
     * 查询一条订单
     * @param $data
     * @return Order|array|mixed|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function goodsOrderOne($data)
    {
        $result = Order::where($data)->find();
        return $result;
    }

    /**
     * yuql
     * 生成订单 添加入库
     * @param $data
     * @return Order|Model
     */
    public static function goodsOrderAdd($data)
    {
        $result = Order::create($data);
        return $result;
    }


    /**
     * yuql
     * 根据 uid查询所有该用户拥有的订单
     * @param $data
     * @return Order
     */
    public static function goodsOrders($data)
    {
        $result = Order::where($data)->select()->toArray();
        return $result;
    }

    /**
     * yuql
     * 查询一条订单数据
     * @param $data
     * @return array
     */
    public static function payAfterGoodsOrder($data)
    {
        $result = Order::where($data)->select()->toArray();
        return $result;
    }

}
